import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import VideoPlayer from 'vue-video-player'
require('video.js/dist/video-js.css')
require('vue-video-player/src/custom-theme.css')
Vue.use(VideoPlayer)


// 样式重置
import '@/assets/style/reset.css'
// 公用样式
import '@/assets/style/common.less'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
//动画库，官网：https://animate.style/
import 'animate.css'
import directiveList from './directive'
import publicMethod from './util/publicMethods.js';
import axios from "axios";

Vue.prototype.$public = publicMethod;


//循环创建指令
directiveList.forEach(item => {
  Vue.directive(item.name, item.method)
})

Vue.use(ElementUI)
Vue.config.productionTip = false
// Vue 定义自定义指令:防止按钮重复提交
Vue.directive('preventReClick', {
  inserted (el, binding) {
    el.addEventListener('click', () => {
      if (!el.disabled) {
        el.disabled = true
        setTimeout(() => {
          el.disabled = false
        },binding.value || 1000)
      }
    })
  }
})
new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
